// MongoDB initialization script for TCM Smart Health Assistant

const databaseName = 'tcm_ai_db';
const dbInstance = db.getSiblingDB(databaseName);

// GridFS bucket for raw images will be created automatically when uploading.

dbInstance.createCollection('image_records');
dbInstance.image_records.createIndex({ userId: 1, createdAt: -1 });

dbInstance.createCollection('ai_analysis_results');
dbInstance.ai_analysis_results.createIndex({ recordId: 1 });

dbInstance.createCollection('qa_feedback');
dbInstance.qa_feedback.createIndex({ qaRecordId: 1 });

print(`MongoDB database '${databaseName}' initialized.`);

